﻿namespace DimensionsHelper.LanguageService.Syntax;

/// <summary>
///     操作符上下文类型
/// </summary>
[Flags]
public enum OperatorContexts
{
    /// <summary>
    ///     操作符可以使用在预处理语句上下文中
    /// </summary>
    Preprocessor = 0x1,

    /// <summary>
    ///     操作符可以使用在脚本上下文中
    /// </summary>
    Script = 0x2,

    /// <summary>
    ///     操作符可以使用在所有上下文中
    /// </summary>
    All = Preprocessor | Script
}


/// <summary>
///     符号的上下文类型
/// </summary>
[Flags]
public enum PunctuationContexts
{
    /// <summary>
    ///     预处理器有效的符号
    /// </summary>
    Preprocessor = 0x1,

    /// <summary>
    ///     脚本的有效符号
    /// </summary>
    Script = 0x2,

    /// <summary>
    ///     元数据有效符号
    /// </summary>
    Metadata = 0x4,

    /// <summary>
    ///     在分类常量中
    /// </summary>
    Categorical = 0x8,

    /// <summary>
    ///     在 OnNextCase 的 Event 语句块中
    /// </summary>
    OnNextCaseEvent = 0x10,

    /// <summary>
    ///     非预处理器符号
    /// </summary>
    NotPreprocessor = Script | Metadata,

    /// <summary>
    ///     所有上下文下都有效的符号
    /// </summary>
    All = Preprocessor | Script | Metadata
}


/// <summary>
///     关键字的上下文类型
/// </summary>
[Flags]
public enum KeywordContexts
{
    /// <summary>
    ///     预处理器
    /// </summary>
    Preprocessor = 0x1,

    /// <summary>
    ///     .mrs 扩展名文件或dms section中使用的关键字
    /// </summary>
    Mrs = 0x2,

    /// <summary>
    ///     .dms 扩展名文件中使用的关键字
    /// </summary>
    Dms = 0x4,

    /// <summary>
    ///     元数据关键字
    /// </summary>
    Metadata = 0x8,

    /// <summary>
    ///     声明文件关键字
    /// </summary>
    Declaration = 0x10,

    /// <summary>
    ///     所有上下文
    /// </summary>
    All = Preprocessor | Mrs | Dms | Metadata | Declaration,

    /// <summary>
    ///     非元数据上下文
    /// </summary>
    NotMetadata = Preprocessor | Mrs | Dms
}


[Flags]
public enum SyntaxNodeFlags
{
    None = 0,

    /// <summary>
    ///     文件的第一个节点
    /// </summary>
    StartOfFile = 0x1,

    /// <summary>
    ///     节点前方带有换行符
    /// </summary>
    PrecedingLinebreak = 0x2,

    /// <summary>
    ///     节点后方带有换行符
    /// </summary>
    TrailingLinebreak = 0x4,

    /// <summary>
    ///     多行字符串
    /// </summary>
    MultilineString = 0x8,

    /// <summary>
    ///     未终结的字符串
    /// </summary>
    UnterminatedString = 0x10,

    /// <summary>
    ///     前方带有 Option Implicit语句
    /// </summary>
    OptionImplicit = 0x20,

    /// <summary>
    ///     前方带有 Option GlobalVariables语句
    /// </summary>
    OptionGlobalVariables = 0x40,

    /// <summary>
    ///     此节点是无效的标识符
    /// </summary>
    InvalidIdentifier = 0x80,

    /// <summary>
    ///     此节点是通过宏展开得到的
    /// </summary>
    MacroExpanded = 0x100,

    /// <summary>
    ///     宏扩展节点
    /// </summary>
    MacroExpansion = 0x200,

    /// <summary>
    ///     指定节点在 #if 的条件语句中
    /// </summary>
    PreprocessorIfCondition = 0x400,

    /// <summary>
    ///     指定节点在OnNextCase类型的Event语句块中
    /// </summary>
    OnNextCaseEvent = 0x800,

    /// <summary>
    ///     指定节点所在的语法树中带有ignore-type-error的注释指令
    /// </summary>
    IgnoreTypeError = 0x1000
}